package utils
{
	import flash.display.DisplayObject;
	import flash.display.InteractiveObject;
	
	import globals.Global;
	
	import spark.components.Label;
	import spark.components.TextInput;
	import spark.filters.GlowFilter;

	/**
	 * UI管理器
	 * @author XiLing
	 */
	public class UtilsUIManager
	{		
		public static function changeFocusOn(_toFocus:InteractiveObject):void
		{
			Global.stage.focus = _toFocus;
		}
		
		/**
		 * 描边+抖动
		 * @param _checkDisplayObject
		 * @param _errorText
		 * @param _errorTextL
		 */
		public static function enableErrorByStyle1(_checkDisplayObject:DisplayObject,_errorTextL:Label,_errorText:String="",_enable:Boolean=true):void
		{
			if(_enable)
			{
				_checkDisplayObject.filters = [new GlowFilter(0xff0000)];
				_errorTextL.text = _errorText;
				UtilsAnimation.shake(_checkDisplayObject);
				if(_checkDisplayObject is TextInput)
				{
					changeFocusOn(_checkDisplayObject as TextInput);
				}
			}
			else
			{
				_checkDisplayObject.filters = [];
				_errorTextL.text = "";
			}
			
		}
	}

}